Plug-ins¶
All SIS applications, eg Cadcorp SIS Desktop Express, Cadcorp SIS Desktop, the SIS Control, GeognoSIS, SISpy, etc, can read from (a Dataset),
and in some cases write to (an Exporter), data sources using a program written in C++ and supplied to the end-user as a Dynamic Link Library (DLL).
A SIS Plug-in uses two Cadcorp-supplied files (a .lib and two .h-s) which contain a suite of C++ classes used by the DLL to communicate with the SIS
application, SIS Control, GeognoSIS, etc.
Plug-ins can also:
- serve dynamic images (an Image Server)
- resolve named locations to an extents (a Gazetteer)
- resolve strings to a position in a regular grid (a Namer)
- parse string input and return a location (a Geocoder)
Creating¶
Microsoft Visual Studio version requirements
Plug-in DLLs for this version of SIS must be created using Microsoft Visual Studio 2017
Create a new Microsoft Visual Studio 2017 project¶
- Start Microsoft Visual Studio 2017 and select the File/New/Project… command
- Choose MFC/ATL from the Visual C++ entry in the Templates tree
- Select MFC DLL icon from the list of templates, and choose a name and location for the project
- Press the OK button to proceed to the MFC DLL dialog
- Click on the DLL type option, and choose MFC extension DLL
- Press the OK button to create the new project
Insert the SIS files into the project¶
32-bit and 64-bit builds
There are two versions of LibPlugin90.lib (32-bit and 64-bit) and you must be careful to use the correct version for each build configuration
- Copy the SIS Plug-in files (
LibPlugin90.lib,LibPlugin.handLibPluginVersion.h) into your project directory structure, ensuring that the.hfiles are in theIncludepath, and the.libfile is in theLinkerpath.
Create the Plug-in class¶
- Select the File/New/File… command
- Choose Visual C++ from the Categories list, C++ File (.cpp) from the Templates list, and type a name for the file
- See the Sample for details of each specific type, eg Dataset, Exporter, etc
Building¶
Build compatibility
The Release build option must be chosen in order to be compatible with the released versions of the SIS applications, SIS Control, GeognoSIS, etc
- Select the Build/Build <project name> command to compile and build the DLL
Using¶
-
Copy the built DLL to Plugins sub-directory of the SIS application, SIS Control, GeognoSIS, etc, directory
The built DLL file can be found in the Release, or x64\Release for 64-bit builds, sub-directory of the Visual C++ project
Debugging¶
Although SIS Plug-in DLLs must be built using the Release configuration option in order to be compatible with the released versions of the SIS applications, SIS Control, GeognoSIS, etc, it is possible to debug the Plug-in code using Microsoft Visual Studio.
The default settings for this configuration option allow the DLL being debugged with SIS.
- Select the Project/Properties… command
- Select the settings for the Release configuration option
- Select the Debugging entry in the Configuration Properties tree
- Change the Command property to Cadcorp.SIS.exe, and the Working Directory to the location of Cadcorp.SIS.exe
- Set debug breakpoints as required, eg in the
::Readmethod of a Dataset - Select the Debug/Start command to run Cadcorp.SIS.exe
Sample Plug-ins¶
Note
You must copy the LibPlugin.h, LibPluginVersion.h and the correct LibPlugin90.lib (32- or 64-bit) files into the project directory before building
Dataset¶
This sample shows how to implement a file-based Dataset that creates various SisItem classes, sets their properties/attributes, and handles dynamic properties/attributes, known as ‘fields”. It also demonstrates use of EPSG coordinate reference system codes and OGC Well-known Text strings.
A Dataset.sample file is provided, which can be opened by normal SIS methods, eg drag-and-drop. NB The contents of the file are ignored, only the .sample file extension is significant.
DataSource¶
This sample has identical behaviour to the Dataset one, but is not file-based. It can be opened via the Add Overlay Wizard, in the Miscellaneous category.
Exporter¶
This sample shows how to iterate over, and extract information from, SisItem classes when exporting. It also shows how to handle a configuration dialog.
Gazetteer¶
This sample shows how to implement a Gazetteer, for fast location lookups that change the view in the current Map Window.
ImageServer¶
This sample shows how to implement dynamic SisItemImage rendering, via the RenderImage method, using images dynamically generated from the Mandelbrot set. By default the width and height, in pixels, of the SisItemImage will be 2^24 (16,777,216).
Namer¶
This sample shows how to implement a Namer, ie an Index Dataset Tile Naming Convention, using a simple alphabetical-character-based scheme. Sample tiles are provided, in the Namer folder, as Windows Bitmap files.
Assets¶
The Plug-in library and header files can be downloaded from here, and the sample Plug-in project can be downloaded from here